<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>年会抽奖</title>
  <style>
    .wrapper {
      width: 840px;
      height: 420px;
      background: url(./images/bg01.jpg) no-repeat center / cover;
      padding: 100px 250px;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <div class="wrapper">
    <strong>传智教育年会抽奖</strong>
    <h1>一等奖：<span id="one">???</span></h1>
    <h3>二等奖：<span id="two">???</span></h3>
    <h5>三等奖：<span id="three">???</span></h5>
  </div>
  <script>
    const arr = ['周杰伦', '张学友', '刘德华', 'pink老师', '李宗盛'];
    //生成随机数
    const random1 = Math.floor(Math.random() * arr.length);
    //获取元素
    const one = document.querySelector('#one');
    // 改变元素内容
    one.innerHTML = arr[random1];
    // 删除已选过的名字
    arr.splice(random1, 1);


    //生成随机数
    const random2 = Math.floor(Math.random() * arr.length);
    //获取元素
    const two = document.querySelector('#two');
    // 改变元素内容
    two.innerHTML = arr[random2];
    // 删除已选过的名字
    arr.splice(random2, 1);

    //生成随机数
    const random3 = Math.floor(Math.random() * arr.length);
    //获取元素
    const three = document.querySelector('#three');
    // 改变元素内容
    three.innerHTML = arr[random3];
    // 删除已选过的名字
    arr.splice(random3, 1);
  </script>
</body>

</html>